import {
    CheckboxParser,
    ColParser,
    IconParser,
    NoopParser,
    ProgressParser,
    RadioParser,
    RowListParser,
    RowParser,
    SliderParser,
    SwiperParser,
    SwitchParser,
    TabsParser
} from ".";
import type { ParseWxTagsFunc } from ".";

export class ParserFactory {
    static create(name: string, recurse?: ParseWxTagsFunc) {
        switch (name) {
            case 'ui-row-list':
                return new RowListParser();
            case 'ui-row':
                return new RowParser();
            case 'ui-col':
                return new ColParser(recurse);
            case 'ui-icon':
                return new IconParser();
            case 'ui-tabs':
                return new TabsParser();
            case 'switch':
                return new SwitchParser();
            case 'checkbox':
                return new CheckboxParser();
            case 'radio':
                return new RadioParser();
            case 'slider':
                return new SliderParser();
            case 'progress':
                return new ProgressParser();
            case 'swiper':
                return new SwiperParser();
            default:
                return new NoopParser();
        }
    }
}
